<?php
	$title = 'title_'.$this->lang;
	$description = 'description_'.$this->lang;
?>
	<div class="box-h1">
		<h1 title="Search Books Result"><i>
			<em><?=Kohana::lang('site.viewcart')?></em> -> 
			<?=Kohana::lang('site.login')?> -> 
			<?=Kohana::lang('site.shipping')?> -> 
			<?=Kohana::lang('site.invoice')?> -> 
			<?=Kohana::lang('site.payment')?></i>
			<?=Kohana::lang('title.yourcart')?>
		</h1>
		<div class="box1">
		<?php if(isset($this->cart) and count($this->cart['items'])>0) { ?>
			<form id="change_quantity" method="post" action="<?=url::site('cart/changequantity')?>" onsubmit="return Validator.Validate(this,3)">
			<table id="cart-item-list" width="100%"><tr>
				<th width="50%"><?=Kohana::lang('site.product_name')?></th>
				<th width="10%">ISBN</th>
				<th width="10%" class="right"><?=Kohana::lang('site.quantity')?>(<a onclick="$('change_quantity').submit();"><?=Kohana::lang('site.change_quantity')?></a>)</th>
				<th width="10%" class="right"><?=Kohana::lang('site.price')?></th>
				<th width="10%" class="right"><?=Kohana::lang('site.subtotal')?></th>
				<th width="10%"></th>
			</tr><?php foreach($products as $product) { ?><tr>
				<td><?=html::anchor('bookstore/product/'.$product->category_id.'/'.$product->id, $product->$title)?></td>
				<td><?=$product->sku?></td>
				<td class="right"><input class="qi" name="qid<?=$product->id?>" value="<?=$carts['items'][$product->id]['quantities']?>" dataType="Number" msg="请输入数字"/></td>
			<?php if($this->cart['items'][$product->id]['quantities'] <= $product->quantity) { ?>
				<td class="right">$<?=$product->price?></td>
				<td class="right">$<?=sprintf("%01.2f", $product->price*$this->cart['items'][$product->id]['quantities'])?></td>
			<?php } else { ?>
				<td colspan="2">Out of stock.</td>
			<?php } ?>
				<td class="center"><?=html::anchor('cart/delete/'.$product->id, Kohana::lang('site.delete'))?></td>
			</tr><?php } ?><tr>
				<td colspan="6" class="right" style="background-color:#DADADA"><?=Kohana::lang('site.total')?>: $<?=$carts['items_total']?></td>
			</tr></table></form>
			<div id="cart-btn">
				<div style="float:right;"><?=html::anchor('bookstore/category/1/1', Kohana::lang('site.continue_shopping'))?></div>
				<?php if ($this->cart['items_sum'] > 0 ) { ?>
				<span class="group-payment">
					<a><?=Kohana::lang('site.group_payment')?></a>
					<div class="group-type">
						<?=html::anchor('order/create/bookstore', Kohana::lang('site.bookstore').($this->lang=='en'?' ':'').Kohana::lang('site.checkout'))?>
						<?=html::anchor('order/create/school', Kohana::lang('site.school').($this->lang=='en'?' ':'').Kohana::lang('site.checkout'))?>
					</div>
				</span>
				<?=html::anchor('order/create/normal', Kohana::lang('site.individual_payment'))?>
				<?php } ?>
			</div>
		<?php } else { ?>
			<?=Kohana::lang('site.cart_is_empty')?>
		<?php } ?>	
		</div>
	</div>
